package com.numbfish.ch06_ex01_mvc_request.controller;

import com.numbfish.ch06_ex01_mvc_request.pojo.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
public class JsonController {
    @RequestMapping(path = "/person/json/data", method = RequestMethod.POST,produces = "application/json")
    @ResponseBody
    //@PostMapping("/person/json/data")
    public Person receiveJson(@RequestBody Person person) {
        System.out.println(person);

        person.setAge(100);

        return person;
    }
    @GetMapping("/person/form")
    public String personForm(){
        System.out.println("in");
        return "person-json";
    }
}
